#! /bin/bash

if [ "$1" == "c" ]
then
	mkdir -p bin
	javac -classpath .:src/:lib/jl1.0.jar:lib/core.jar:lib/sqlitejdbc.jar -Xlint src/cn/the/angry/SplashScreen.java -d bin/
elif [ "$1" == "" ]
then
	java -classpath .:bin/:lib/jl1.0.jar:lib/core.jar:lib/sqlitejdbc.jar cn.the.angry.SplashScreen &
elif [ "$1" == "s" -a "$2" == "c" ]
then
	cd AngryPigServer/
	mkdir -p bin/
	javac -classpath .:src/:../lib/sqlitejdbc.jar src/Server.java -Xlint -d bin
elif [ "$1" == "s" -a "$2" == "" ]
then
	cd AngryPigServer/
	java -classpath .:bin/:../lib/sqlitejdbc.jar Server &
elif [ "$1" == "clean" ]
then
	find . -name "*.class" | xargs -i rm -f {} 
else
	echo "Parameter(s): [s|c] [c]"
	exit 1
fi
